package bairui.international.model.domain.jpa;

import com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue;

/**
 *
 * (用户信息)TB_UserInfo
 *
 * @说明
 * <pre>

 * </pre>
 *
 * @see Help_TB_UserInfo#inheritance() 继承体系信息
 *
 */
@org.hibernate.annotations.DynamicInsert
@org.hibernate.annotations.DynamicUpdate

@javax.persistence.Entity(name="t_userInfo")
@com.lianjing.sh.processing.info.annotation.GenerateInfoModel
@SuppressWarnings("serial")
@com.lianjing.sh.model.common.annotation.Comment("用户信息")
@com.lianjing.sh.processing.info.annotation.InfoComment("用户信息")
public class TB_UserInfo
 extends TBSuper_BaseIDAndTimeAndOrderValue
 implements 
	com.lianjing.sh.model.common.stardard.TableModel<Long>,
	java.io.Serializable

{

	
	
	/**
	 * 必须属性赋值接口
	 */
	public static interface MustProperties{
		/** 产品订单 */
		public bairui.international.model.domain.jpa.TB_ProductOrder getProductOrder();
	}
	
	/**
	 * 为必须属性赋值
	 */
	public TB_UserInfo properties(MustProperties properties) {
		this.setProductOrder(properties.getProductOrder());
		return this;
	}
	
	/**
	 *	必须属性构造函数
	 */
	public TB_UserInfo(MustProperties properties) {
		this.properties(properties);
	}
	
	
	/**
	 * 可选单属性赋值接口
	 */
	public static interface OptionalSingleProperties{
		/** 微信昵称 */
		public String getNickName();
		/** 真实姓名 */
		public String getRealName();
		/** 公司 */
		public String getCompany();
		/** 用户类型 */
		public bairui.international.model.type.Type_User getUserType();
	}
	
	/**
	 * 为可选单属性赋值
	 */
	public TB_UserInfo properties(OptionalSingleProperties properties) {
		this.setNickName(properties.getNickName());
		this.setRealName(properties.getRealName());
		this.setCompany(properties.getCompany());
		this.setUserType(properties.getUserType());
		return this;
	}
	
	
	
	public TB_UserInfo(MustProperties must, OptionalSingleProperties optionalSingle) {
		this.properties(must);
		this.properties(optionalSingle);
	}
	
	/**
	 * 仅当前必须属性赋值接口
	 */
	public static interface CurrentMustProperties{
		/** 产品订单 */
		public bairui.international.model.domain.jpa.TB_ProductOrder getProductOrder();
	}
	
	/**
	 * 为仅当前必须属性赋值
	 */
	public TB_UserInfo properties(CurrentMustProperties properties) {
		this.setProductOrder(properties.getProductOrder());
		return this;
	}
	
	/**
	 * 仅当前可选单属性赋值接口
	 */
	public static interface CurrentOptionalSingleProperties{
		/** 微信昵称 */
		public String getNickName();
		/** 真实姓名 */
		public String getRealName();
		/** 公司 */
		public String getCompany();
		/** 用户类型 */
		public bairui.international.model.type.Type_User getUserType();
	}
	
	/**
	 * 为仅当前可选单属性赋值
	 */
	public TB_UserInfo properties(CurrentOptionalSingleProperties properties) {
		this.setNickName(properties.getNickName());
		this.setRealName(properties.getRealName());
		this.setCompany(properties.getCompany());
		this.setUserType(properties.getUserType());
		return this;
	}
	
	public TB_UserInfo(
		@lombok.NonNull com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean,
		CurrentMustProperties mustProperties,
		CurrentOptionalSingleProperties optionalProperties
	) {
		this(bean);
		this.properties(mustProperties);
		this.properties(optionalProperties);
	}
	
	public TB_UserInfo(
		@lombok.NonNull com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean
	) {
		update(bean);
	}
	
	public TB_UserInfo update(com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean){
		this.setId(bean.getId());
		this.setCreateTime(bean.getCreateTime());
		this.setModifyTime(bean.getModifyTime());
		this.setOrderValue(bean.getOrderValue());
		return this;
	}
	
	
	/**
	 * 更新属性内部类
	 */
	public abstract class UpdateProperties {
	
		public UpdateProperties() throws Exception {
			Integer orderValue = getOrderValue(TB_UserInfo.this);
			if(isOverride_getOrderValue){
				TB_UserInfo.this.setOrderValue(orderValue);
			}
	
			bairui.international.model.domain.jpa.TB_ProductOrder productOrder = getProductOrder(TB_UserInfo.this);
			if(isOverride_getProductOrder){
				TB_UserInfo.this.setProductOrder(productOrder);
			}
	
			String nickName = getNickName(TB_UserInfo.this);
			if(isOverride_getNickName){
				TB_UserInfo.this.setNickName(nickName);
			}
	
			String realName = getRealName(TB_UserInfo.this);
			if(isOverride_getRealName){
				TB_UserInfo.this.setRealName(realName);
			}
	
			String company = getCompany(TB_UserInfo.this);
			if(isOverride_getCompany){
				TB_UserInfo.this.setCompany(company);
			}
	
			bairui.international.model.type.Type_User userType = getUserType(TB_UserInfo.this);
			if(isOverride_getUserType){
				TB_UserInfo.this.setUserType(userType);
			}
		}
	
		public TB_UserInfo up(){
			return TB_UserInfo.this;
		}
	
		/** 排序值 */
		private boolean isOverride_getOrderValue = true;
		public Integer getOrderValue(TB_UserInfo it) throws Exception { 
			isOverride_getOrderValue = false; 
			return null;
		}
		/** 产品订单 */
		private boolean isOverride_getProductOrder = true;
		public bairui.international.model.domain.jpa.TB_ProductOrder getProductOrder(TB_UserInfo it) throws Exception { 
			isOverride_getProductOrder = false; 
			return null;
		}
		/** 微信昵称 */
		private boolean isOverride_getNickName = true;
		public String getNickName(TB_UserInfo it) throws Exception { 
			isOverride_getNickName = false; 
			return null;
		}
		/** 真实姓名 */
		private boolean isOverride_getRealName = true;
		public String getRealName(TB_UserInfo it) throws Exception { 
			isOverride_getRealName = false; 
			return null;
		}
		/** 公司 */
		private boolean isOverride_getCompany = true;
		public String getCompany(TB_UserInfo it) throws Exception { 
			isOverride_getCompany = false; 
			return null;
		}
		/** 用户类型 */
		private boolean isOverride_getUserType = true;
		public bairui.international.model.type.Type_User getUserType(TB_UserInfo it) throws Exception { 
			isOverride_getUserType = false; 
			return null;
		}
	
	}
	
	
	/**
	 * 构造函数
	 */
	public TB_UserInfo() {
	}
	
	public TB_UserInfo(
		@lombok.NonNull Long id
	) {
		this.setId(id);
	}
	
	public TB_UserInfo(
		@lombok.NonNull TB_UserInfo bean
	) {
		this.setId(bean.getId());
		this.setCreateTime(bean.getCreateTime());
		this.setModifyTime(bean.getModifyTime());
		this.setOrderValue(bean.getOrderValue());
		this.setProductOrder(bean.getProductOrder());
		this.setNickName(bean.getNickName());
		this.setRealName(bean.getRealName());
		this.setCompany(bean.getCompany());
		this.setUserType(bean.getUserType());
	}
	
	

	


	/**
	 * 属性
	 */
	@com.lianjing.sh.model.common.annotation.Comment("产品订单")
	@com.lianjing.sh.processing.info.annotation.InfoComment("产品订单")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.OneToOne(optional=false)
	private bairui.international.model.domain.jpa.TB_ProductOrder productOrder;

	@com.lianjing.sh.model.common.annotation.Comment("微信昵称")
	@com.lianjing.sh.processing.info.annotation.InfoComment("微信昵称")
	@javax.persistence.Column(name="nickName", length=255)
	private String nickName;

	@com.lianjing.sh.model.common.annotation.Comment("真实姓名")
	@com.lianjing.sh.processing.info.annotation.InfoComment("真实姓名")
	@javax.persistence.Column(name="realName", length=30)
	private String realName;

	@com.lianjing.sh.model.common.annotation.Comment("公司")
	@com.lianjing.sh.processing.info.annotation.InfoComment("公司")
	@javax.persistence.Column(name="company")
	private String company;

	@com.lianjing.sh.model.common.annotation.Comment("用户类型")
	@com.lianjing.sh.processing.info.annotation.InfoComment("用户类型")
	@javax.persistence.Enumerated(javax.persistence.EnumType.STRING)
	@javax.persistence.Column(name="userType")
	private bairui.international.model.type.Type_User userType;

	/** get[产品订单] */
	public bairui.international.model.domain.jpa.TB_ProductOrder getProductOrder() {
		return this.productOrder;
	}

	/** get[微信昵称] */
	public String getNickName() {
		return this.nickName;
	}

	/** get[真实姓名] */
	public String getRealName() {
		return this.realName;
	}

	/** get[公司] */
	public String getCompany() {
		return this.company;
	}

	/** get[用户类型] */
	public bairui.international.model.type.Type_User getUserType() {
		return this.userType;
	}

	/** set[产品订单] */
	public void setProductOrder(bairui.international.model.domain.jpa.TB_ProductOrder productOrder) {
		this.productOrder = productOrder;
	}

	/** set[微信昵称] */
	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	/** set[真实姓名] */
	public void setRealName(String realName) {
		this.realName = realName;
	}

	/** set[公司] */
	public void setCompany(String company) {
		this.company = company;
	}

	/** set[用户类型] */
	public void setUserType(bairui.international.model.type.Type_User userType) {
		this.userType = userType;
	}

	public void assignProductOrder(bairui.international.model.domain.jpa.TB_ProductOrder productOrder) {
		if(null != productOrder){
			productOrder.setUserInfo(this);
		}
		this.setProductOrder(productOrder);
	}
	

	
	
	

	/** take[产品订单] */
	public bairui.international.model.domain.jpa.TB_ProductOrder takeProductOrder(){
		if(null == this.productOrder){
			this.productOrder = new bairui.international.model.domain.jpa.TB_ProductOrder();
		}
		return this.productOrder;
	}
	
	/** must[产品订单] */
	public bairui.international.model.domain.jpa.TB_ProductOrder mustProductOrder() {
		return this.productOrder;
	}
	
	

	/**
	 * 复写 hashCode
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		return prime * result + ((this.getId() == null) ? 0 : this.getId().hashCode());
	}
	
	/**
	 * 复写 equals
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj){
			return true;
		}
		if (obj == null){
			return false;
		}
		if (getClass() != obj.getClass()){
			return false;
		}
		TB_UserInfo other = (TB_UserInfo) obj;
		if (this.getId() == null) {
			return false;
		} else if (!this.getId().equals(other.getId())){
			return false;
		}
		return true;
	}
	

	/**
	 * 用来覆盖toString()的输出
	 */
	@javax.persistence.Transient
	private String toString;
	
	public void setToString(String toString) {
		this.toString = toString;
	}
	
	/**
	 * 复写 toString
	 */
	@Override
	public String toString() {
		if(null != this.toString){
			return this.toString;
		}
		return super.toString();
	}	

	@javax.persistence.PrePersist
	public void prePersist() {
		this.setCreateTime(new java.util.Date());
		this.setModifyTime(new java.util.Date());
	}
	
	@javax.persistence.PreUpdate
	public void preUpdate() {
		this.setModifyTime(new java.util.Date());
	}



}
